import React, { Component } from 'react'

export default class Parent2 extends Component {
    state={
        num:0
    }
  render() {
    return (
      <div style={{
        width:'280px',
        height:'200px',
        background:'springgreen',
        display:'flex',
        justifyContent:'space-between',
        alignItems:'center',
        padding:'10px'
      }}>
       <button onClick={()=>this.setState({num:this.state.num+1})}>更新</button>
        <Child3></Child3>
        <Child4></Child4>
      </div>
    )
  }
}
class Child3 extends Component{
    render(){
        console.log('-----Parent2的Child3的render-----------');
        return(<div style={{
            width:'130px',
            height:'150px',
            background:'pink',
            display:'flex',
            justifyContent:'center',
            alignItems:'center',
          }}>Child3</div>)
    }
}
class Child4 extends Component{
    render(){
        console.log('-----Parent2的Child4的render-----------');
        return(<div style={{
            width:'130px',
            height:'150px',
            background:'skyblue',
            display:'flex',
            justifyContent:'center',
            alignItems:'center',
          }}>Child4</div>)
    }
}
